import request from "@/router/axios";
import { baseUrl } from "@/config/env";

//查询我的待审批列表
export function getMyApproveList(data) {
  return request({
    url: baseUrl + "/pc/flow/myApproveList",
    method: "get",
    params: data
  });
}

//查询已办
export function getHasApprove(data) {
  return request({
    url: baseUrl + "/pc/flow/hasApprove",
    method: "get",
    params: data
  });
}

//审批流程
export function approveFlow(data) {
  return request({
    url: baseUrl + "/pc/flow",
    method: "post",
    data
  });
}

// 根据id 查询审批流程
const path = {
  // 德育 type:10
  deyuData: baseUrl + "/pc/moral-education-task/",
  //学生干部任职 type:20
  jobTask: baseUrl + "/pc/job-task/",
  // 好人好事 type:30
  goodThings: baseUrl + "/pc/good-things-task/",
  // 公益活动 type:40
  welFare: baseUrl + "/pc/public-welfare-activities-task/",
  // 证书 type:50
  certificate: baseUrl + "/pc/certificate-task/",
  // 创新创业 type:60
  innovative: baseUrl + "/pc/innovative-undertaking-task/",
  //学科竞赛 type:70
  course: baseUrl + "/pc/course-contests-task/",
  //文艺活动 type:80
  cultural: baseUrl + "/pc/cultural-activities-reward-task/",
  // 文化传播
  cluturalTransmission: baseUrl + "/pc/cultural-transmission-task/"
};

export const willHttp = async (type, data, method = "GET") => {
  const url = path[type] + data;
  return Promise.all([request(url, method)]);
};
